﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace FlexySys.Web.Core
{
    
    #region Sessions
    public static class Sessions<T> where T : new()
    {
        public static T Get()
        {
            if (HttpContext.Current.Session == null || HttpContext.Current.Session[typeof(T).FullName] == null)
                return default(T);
            else
                return (T)HttpContext.Current.Session[typeof(T).FullName];
        }

        public static void Set(T obj)
        {
            HttpContext.Current.Session[typeof(T).FullName] = obj;
        }
    }
    #endregion

}